UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hlWTR2gvorJ/GMAG5UXtKrpX4IdCkAfOTrxnE6aLduo='
WHERE
key_id = '40ab44ed3ab96bb93ab2992f1c9c8d190ca6013dc159b7f04040a268df703d08'
AND (
token = 'hlWTR2gvorJ/GMAG5UXtKrpX4IdCkAfOTrxnE6aLduo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)