UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O0/pjTiQVrOHuKvZTalxcNovd1T8eWNGng3K+ywKD0E='
WHERE
key_id = '6820c63ea39cd18b16716f7cb34253c7b44d2f258057369bf04d511b925fcbb0'
AND (
token = 'O0/pjTiQVrOHuKvZTalxcNovd1T8eWNGng3K+ywKD0E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)