UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8nulJuh6fRgvUhcI78GIgf9fd3w5zPJ/cT3sCC/7mq0='
WHERE
key_id = '4dfc39dc2119538fd61162e97cd386fdd1a34308df0e5840a7181915c89c8204'
AND (
token = '8nulJuh6fRgvUhcI78GIgf9fd3w5zPJ/cT3sCC/7mq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)