UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U9bySSR+RnXULE1MnPxoh2iivWEICQA6V3hVjAcy/TU=' 
WHERE 
  key_id = 'd7f253a9d05eb3e7b6d2bd75d37675f0cbd96013da9e74d0ac6c44c6e03ee83a' 
  AND (
    token = 'U9bySSR+RnXULE1MnPxoh2iivWEICQA6V3hVjAcy/TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017