UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0z4ZObuEH8Muu092YKJoqHONc1FQfXePnET/XYsgmSQ=' 
WHERE 
  key_id = 'f9fba371d17a284c8d0aa8af3b1724eada8df52a2b7994afd07d580ffff2e2c7' 
  AND (
    token = '0z4ZObuEH8Muu092YKJoqHONc1FQfXePnET/XYsgmSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029