UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4vJ0QQOG/ksi+R4Tnt3EPdYBdcqzaKKKfOa70XeNzho='
WHERE
key_id = 'bc94b711448dd90168f9da173832f0a6d03376f076a5b251e2ce1c0019a4511d'
AND (
token = '4vJ0QQOG/ksi+R4Tnt3EPdYBdcqzaKKKfOa70XeNzho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)