UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g5R+POEgZQP3YMoVWzMovsBgTKobiHqne/elxzkebHM=' 
WHERE 
  key_id = '1221bb9537be1afa3877913671388caf5caea55106d760493c335b72ee4d6fe3' 
  AND (
    token = 'g5R+POEgZQP3YMoVWzMovsBgTKobiHqne/elxzkebHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046