UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2zBnCxkr5uyhoVh7ee0TBUzL/W1ZFLjqVyywpH5qNw8='
WHERE
key_id = 'd761b47e23db4a910c117ea6a53662d4cc16344d04fac5e2f9009098c4c009f4'
AND (
token = '2zBnCxkr5uyhoVh7ee0TBUzL/W1ZFLjqVyywpH5qNw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)