UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9iA1/819feLsn1LWmRTOwcnG5EyeY3xyaLfKmY/y9YU=' 
WHERE 
  key_id = '523145158936ddccbb56921bf3a95e557753a729df13605212fbf9c18975f0df' 
  AND (
    token = '9iA1/819feLsn1LWmRTOwcnG5EyeY3xyaLfKmY/y9YU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025