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

Query time 0.00030