UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KNVCsiQBwPcljQU6HyYwqu37bESw2MCayEcBt0W/IHo='
WHERE
key_id = 'de820f84e7c0305e83ea22d667873eec46439f53e7c4cd09022c3b36c1fa2a6a'
AND (
token = 'KNVCsiQBwPcljQU6HyYwqu37bESw2MCayEcBt0W/IHo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)