UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QckjGb7xfb2WJfxLURPk74bU0eYO28MlosOGaXFha3w='
WHERE
key_id = '4235b682b9aa07d9ba6925881571d1bae1c9a8e518eca3629c6e26aea83c32a1'
AND (
token = 'QckjGb7xfb2WJfxLURPk74bU0eYO28MlosOGaXFha3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)