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