UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8cuORhTjqz749bUpJgUNjd2pLZAPQCGBv1DBE1i3++I='
WHERE
key_id = '642db7ee2e88d55a99ab45f0086d26993b648e3f350b73378cd9c2a4c53b8831'
AND (
token = '8cuORhTjqz749bUpJgUNjd2pLZAPQCGBv1DBE1i3++I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)