UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UMRdhYB5BoIGmJjn2d+cMuv0DOxwqnaYxLZT+IBV3nE='
WHERE
key_id = '345a84ee41cc84f6103825298a7753b985b5535c3ff0ae685d36fa687b592dfe'
AND (
token = 'UMRdhYB5BoIGmJjn2d+cMuv0DOxwqnaYxLZT+IBV3nE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)