UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '17RCgXyUMT+TVq1zXXNzX8wNrVPvuT6iXWriA352LOU=' 
WHERE 
  key_id = '18f165a0955685fd27cdf4bbb13fbe9a706cc5adb7734d425a3b64f0fca180a6' 
  AND (
    token = '17RCgXyUMT+TVq1zXXNzX8wNrVPvuT6iXWriA352LOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018