UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+CfV16fQVHsmd3VCiQrtW+SdE8/ZpWXHSqep15b2gw=' 
WHERE 
  key_id = '92beaf18ea5f7a93d68be871935c7c0b0b3136871019676e2f85cd3759866d14' 
  AND (
    token = 'c+CfV16fQVHsmd3VCiQrtW+SdE8/ZpWXHSqep15b2gw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036