UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sly1baWXdBno6y7U1uh9qHahCU5jEj/GQn6Ie/8ue1M='
WHERE
key_id = 'b4afc0202d59f677544aa9da781593262aab758503e6a42f48602b1a745e7be2'
AND (
token = 'Sly1baWXdBno6y7U1uh9qHahCU5jEj/GQn6Ie/8ue1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)