UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9W5j3Mph7OMoctYyymNf7fzmONfZlufYR5ST5JsaYdM='
WHERE
key_id = 'ba176460921e858a35ded922581e332b8e9467b7d75bbe9f1350499c1611b818'
AND (
token = '9W5j3Mph7OMoctYyymNf7fzmONfZlufYR5ST5JsaYdM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)