UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CZQDCQbhCqd2b9uETG6mjXZY9ytdClYy1k0Bfn6GyXc='
WHERE
key_id = '1e524b83f49bbab45bda2212978f9c108c5a9655e74ee9e52d0047ba9f765801'
AND (
token = 'CZQDCQbhCqd2b9uETG6mjXZY9ytdClYy1k0Bfn6GyXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)