UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K1f1wELuUsZKh05fHaNHcEyMUMrRQLFePTcVr2t2fXo='
WHERE
key_id = '0948a9eaa20e2bdca7bf89894a1986ff22ae0d7006ec6155b30e68ceda5d031a'
AND (
token = 'K1f1wELuUsZKh05fHaNHcEyMUMrRQLFePTcVr2t2fXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)