UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c9SwqWlkLZkEH/YEeTHR2EtAuoXV0EmXobYJ+HTm7P0=' 
WHERE 
  key_id = 'a75a34fe0ec257140d42d80ad59169b90c34323486bd7d57414a563316e6fb47' 
  AND (
    token = 'c9SwqWlkLZkEH/YEeTHR2EtAuoXV0EmXobYJ+HTm7P0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032