UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2yNvWw9VJ7ZRqjg+82YdQpFnXTLUguJsstOT6hJpZHc='
WHERE
key_id = '9f3419b2523138416f9a2ff4ad6c4ff15756268e528f362f6319b48a4a355f6c'
AND (
token = '2yNvWw9VJ7ZRqjg+82YdQpFnXTLUguJsstOT6hJpZHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)