UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/E9MAS30f6b8bbvYIbKfUnjyOQb3VwDdeROP4C8uVlM='
WHERE
key_id = '0e2049e2bd3ac190c14d913a2c6f872afc61299db4e0df03b56c20f8819e900c'
AND (
token = '/E9MAS30f6b8bbvYIbKfUnjyOQb3VwDdeROP4C8uVlM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)