UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XdN2VJmEfarbOznO+8hRbROVfyECa0UrsgwzGhVoMeU=' 
WHERE 
  key_id = '5d5949686a69998b3472fdd11b34b136601d197010cf6405ccf4fafa80fdd71b' 
  AND (
    token = 'XdN2VJmEfarbOznO+8hRbROVfyECa0UrsgwzGhVoMeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038