UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NB8zwVLdD0jjWmmVLEQSgXJ23d2Gj8FZAqoPvwHCykY=' 
WHERE 
  key_id = '1885c70e65daccf1213ee9d73004fe1026ec101b3c09df1588a0469094d3fb3d' 
  AND (
    token = 'NB8zwVLdD0jjWmmVLEQSgXJ23d2Gj8FZAqoPvwHCykY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022