UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5dO3J0hjXgc9R1m2Drcl9eur7MylJ5WGI+rUGSg37Pw='
WHERE
key_id = 'c284e7cf96cebbcd33a56ccbb6b6261ca5fd32c21aebc3ec0a6fc94239c79707'
AND (
token = '5dO3J0hjXgc9R1m2Drcl9eur7MylJ5WGI+rUGSg37Pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)