UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HeQK4CAIruatRuShgCqpvYVcKKRFbhATGqcc4MPiSd8='
WHERE
key_id = '0412793f92c051b3d1263c788e2a1742598813d094101731cdaefab76103cb94'
AND (
token = 'HeQK4CAIruatRuShgCqpvYVcKKRFbhATGqcc4MPiSd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)