UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FA6wUoVt7pi6/YGX5HcGpQmBWNzpvHUBh9DdwzRBF60=' 
WHERE 
  key_id = '0d3395f638fc4d69b57d0fba7532c2490ca2b3083b1133b73c65f719c84e68f0' 
  AND (
    token = 'FA6wUoVt7pi6/YGX5HcGpQmBWNzpvHUBh9DdwzRBF60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022