UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T4vQT9ufbQyE4fO++hx463GyWbBSWrU7G9UP4/30220='
WHERE
key_id = 'bc232adbb449609fe79b45491deed15ad17b4c9123fdde5882f96c2912a9fef5'
AND (
token = 'T4vQT9ufbQyE4fO++hx463GyWbBSWrU7G9UP4/30220='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)