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

Query time 0.00036