UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'luUUCfis7QM6Jc7ybwHEhCkQBuzkgBAkZuojVW6QkQw='
WHERE
key_id = 'b9fec5920ff8060b6a0c57b82c350c9a1f73fdd04f7fb69732a67e1e85e9085a'
AND (
token = 'luUUCfis7QM6Jc7ybwHEhCkQBuzkgBAkZuojVW6QkQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)