UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VJaN2d+hsZ7tXagELmy7HFqHZiN8OV9G5L5H4qPmfe4='
WHERE
key_id = '9296061ac248f57b4fddf60e01bc0dc2fb7217766d0db523fd968261afd3d373'
AND (
token = 'VJaN2d+hsZ7tXagELmy7HFqHZiN8OV9G5L5H4qPmfe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)