UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6dqoQlY62kj/LEs4vuX41GVND38Lx/BESvqD5iSBnc=' 
WHERE 
  key_id = 'b248935076d0390cf83edef58dd4a34a364859ddd6b3b8c6b6f3056cd131c85e' 
  AND (
    token = 'D6dqoQlY62kj/LEs4vuX41GVND38Lx/BESvqD5iSBnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078