UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BP2AEFmH+OuYDGBQvtKfPgYte7GiH1rWSSHByOS0EBQ=' 
WHERE 
  key_id = '207b4c4e557c98e36af30b4c0fe323b8423003106bdb87a2423bd3422f392309' 
  AND (
    token = 'BP2AEFmH+OuYDGBQvtKfPgYte7GiH1rWSSHByOS0EBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035