UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REOfacikwztFRhrbYrEeFtUg73dfSXHA4THfyaeQFXw=' 
WHERE 
  key_id = 'd64dcec357b06c018b693fa5514fb6e860e9f9439d177f022e99121108e7065b' 
  AND (
    token = 'REOfacikwztFRhrbYrEeFtUg73dfSXHA4THfyaeQFXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022