UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7BOqeTU40n/aU9biIP/Q6wt+qQImdGoe5B4ghtiQJ8='
WHERE
key_id = '85aff71a7c8ba539719f8db7ca68c8a11e8ae86305fd5dad0909bc57defa4887'
AND (
token = 'r7BOqeTU40n/aU9biIP/Q6wt+qQImdGoe5B4ghtiQJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)