UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CttFh/Y/Y0KamArKdIv1b1tXZbeqXl0pfyHIN2InQ9M=' 
WHERE 
  key_id = 'ae24fcb71d94f21bcd4eea60682223fcc1b66efb1493545190e09fb58008fff5' 
  AND (
    token = 'CttFh/Y/Y0KamArKdIv1b1tXZbeqXl0pfyHIN2InQ9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029