UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm8PVn5EgGYWRPYx9GCZNr5mDxT7k3NaNYWESxwjKpEo='
WHERE
key_id = '99aa6acb948e33cb6c608a81227d0bff49e14bcec1712c194b467abdf26245b5'
AND (
token = 'm8PVn5EgGYWRPYx9GCZNr5mDxT7k3NaNYWESxwjKpEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)