UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0nZXn2uwidZEPg1EHROObLjYYfASPbVKysj1XxMio5g='
WHERE
key_id = '097a39df456036a9077e2c48086f52edf1d9ef173bdc2497972c8ea3efef9dba'
AND (
token = '0nZXn2uwidZEPg1EHROObLjYYfASPbVKysj1XxMio5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)