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