UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jHpB4HmdTkrCUsJ2fJJjxB2wRAJyWLkAbaviqeTTySs=' 
WHERE 
  key_id = 'd2d1ba254f19686e69ad180bcee2620844584d6b4af94bb938996bdcdc129c6d' 
  AND (
    token = 'jHpB4HmdTkrCUsJ2fJJjxB2wRAJyWLkAbaviqeTTySs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026