UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7hAe8W0ZywFgqwtam7iTtNx5X3DD4MMt5xKAUWWE+UU='
WHERE
key_id = '4477c7a4eaa7456dda655b767c58078da8dcdc54c4dd2184b3386b6d4086482e'
AND (
token = '7hAe8W0ZywFgqwtam7iTtNx5X3DD4MMt5xKAUWWE+UU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)