UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WRFSXkXmuidhyZ9h5OlY+NtggXON+VU/BrbL8nQLrn0=' 
WHERE 
  key_id = '903283c518e56ecd4b8ff149eae96ab3e59578de21a58d86de25bca53d163563' 
  AND (
    token = 'WRFSXkXmuidhyZ9h5OlY+NtggXON+VU/BrbL8nQLrn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014