UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QpppMDgSircnSp4qPQ4KRiW2eKESPR5yjACei06dqVQ='
WHERE
key_id = 'ac628a23f3349db1927f19d27e192f7ec4edcde2c145df80444688ca2ee60628'
AND (
token = 'QpppMDgSircnSp4qPQ4KRiW2eKESPR5yjACei06dqVQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)