UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XP7zBjrIuAmuE4b9oQmnj61WxgWe2TDDjD5neMRND/g='
WHERE
key_id = '4da7e770e81b5e2081ba0c51c1dc7e42408029e93dd5372d163068e9ca1db749'
AND (
token = 'XP7zBjrIuAmuE4b9oQmnj61WxgWe2TDDjD5neMRND/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)