UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Uf2C3gbqbrSPq2N9wI5tGIwXH3VQGVYxyrbN35hd/g='
WHERE
key_id = 'f28507180ccfdf673f1777d6950ce76dc29386d3d43049d23eb146224f18cd38'
AND (
token = '9Uf2C3gbqbrSPq2N9wI5tGIwXH3VQGVYxyrbN35hd/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)