UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q40Q2Ga7EwUXO0bNyM1oBdKcVgQh9dXo+NJQFgArNxs='
WHERE
key_id = '43b2514945e94000afc56cd01b8eccf3e2e71e42874df6612883788aa232e42d'
AND (
token = 'Q40Q2Ga7EwUXO0bNyM1oBdKcVgQh9dXo+NJQFgArNxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)