UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x8YEcuBDgt/HkZbsfmOwqWgn8wvuIxKb4EySCzGVv4g='
WHERE
key_id = '1fe4d238acf9a2557330886eb5fb109d8b9dba82923f346d688060c2a863426a'
AND (
token = 'x8YEcuBDgt/HkZbsfmOwqWgn8wvuIxKb4EySCzGVv4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)