UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4uldD/cK3e1TwF0xu+GVaV6i68cB6dzT+hsI7jZn7iY='
WHERE
key_id = 'e9395066c267d5c0bfe830c51743cb71151cd56faea66c2df8e17b0456b7f1e0'
AND (
token = '4uldD/cK3e1TwF0xu+GVaV6i68cB6dzT+hsI7jZn7iY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)