UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '62GEABqwQa/nlrEXqQD8Y8J3JaYHgK3Pm+HzZUZIYsU=' 
WHERE 
  key_id = '138058b8b3f5d03088485df4f6c7c1bf258feaee700df08c35120936f102b95b' 
  AND (
    token = '62GEABqwQa/nlrEXqQD8Y8J3JaYHgK3Pm+HzZUZIYsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036