UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IBUwoIqF7pQJ6xfrV62N4EqkzyNg16MEv2k4K7Raxfk=' 
WHERE 
  key_id = '88c30cb96011975e9996a78de79b85e7755833cd66818103119475daff993f14' 
  AND (
    token = 'IBUwoIqF7pQJ6xfrV62N4EqkzyNg16MEv2k4K7Raxfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029