UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n4JxTa8qqR6xpd9XOhkECegci/ffxyijk1edXPYmBts=' 
WHERE 
  key_id = '8106149aff1d36470f4923dfb89a87fc06ca40f8de362582c0ee99ee267c4bfd' 
  AND (
    token = 'n4JxTa8qqR6xpd9XOhkECegci/ffxyijk1edXPYmBts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025